#include<iostream>

using namespace std;
int N,K,S;
int  num  = 0  ;
int a[291];
int  ans1,ans2;

int main()
{
    cin>>N>>K>>S;
    
    while(N--)
    {
        cin>>ans1>>ans2;
        if(ans1>=175)
        {
            if(ans2>=S)
                num++;
            else if(a[ans1]<K)
            {
                a[ans1]++;
                num++;
            }
        }
    }
    cout<<num;
return 0 ;  }
